package lcc.cj;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;




public class ConnectionManager {

	public static void insertCouponFeed(product Product) throws SQLException {		
	
		Connection conn=null;
		CallableStatement cStmt=null;
	
	try
	{
		conn=DBUtils.getDBConnection();
		cStmt=conn.prepareCall("{call DISCOUNT_USER.CJ_PRODUCT_SEARCH_PKG.insertcj(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
		cStmt.setString(1, Product.getAdid());
		cStmt.setString(2, Product.getAdvertiserid());
		cStmt.setString(3, Product.getAdvertisername());
		cStmt.setString(4, Product.getAdvertisercategory());
		cStmt.setString(5, Product.getBuyurl());
		cStmt.setString(6, Product.getCatalogid());
		cStmt.setString(7, Product.getCurrency());
		cStmt.setString(8, Product.getDescription());
		cStmt.setString(9, Product.getImageurl());
		cStmt.setString(10, Product.getInstock());
		cStmt.setString(11, Product.getIsbn());
		cStmt.setString(12, Product.getManufacturername());
		cStmt.setString(13, Product.getManufacturersku());
		cStmt.setString(14, Product.getName());
		cStmt.setString(15,Product.getPrice());
		cStmt.setString(16, Product.getRetailprice());
		cStmt.setString(17, Product.getSaleprice());
		cStmt.setString(18, Product.getSku());
		cStmt.setString(19,Product.getUpc());
		
		cStmt.execute();
	}
	catch (Exception ex){
		System.out.println(ex.getMessage());
	} finally{
		DBUtils.cleanUp(conn,cStmt);
	}
}
}
